#ifndef PLAY_STATE_H_INCLUDED
#define PLAY_STATE_H_INCLUDED

#include "GameState.h"
#include "Singleton.h"
#include "Camera.h"
#include "Image.h"
#include "Text.h"
#include "CustomCursor.h"
#include "Button.h"
#include <vector>

class Catapult;
class Ball;
class PowerSlider;

class PlayState : public GameState, public Uncopyable
{
private:
	PlayState();
	friend class Singleton<PlayState>;

public:
	
	void OnActivated();
	void OnDeactivated();
	void Draw();
	void Update();
	
	void OnKeyboardEvent(const SDL_KeyboardEvent& k);
	void OnMouseButtonDownEvent(const SDL_MouseButtonEvent& m);
	void OnMouseMotionEvent(const SDL_MouseMotionEvent& mm);

	void LoadButton();
	bool LoadLevel();
	void LoadImg();
	void LoadText();
	void DrawRemainingBalls();

	Ball* GetBall();
	void SetBall(Ball* b);
	void BallThrown();
	void CheckWin();
	int GetScore();
	void AddToScore(int score);
	void SetTargetScore(int target);
	void SetTotalBalls(int balls);

	Catapult* GetCatapultAddress();
	void SetCatapultAddress(Catapult* catapult);
	void SetLevel(const std::string& fileName);

private:

	std::string m_level;

	unsigned int m_score;
	unsigned int m_targetScore;
	unsigned int m_numThrownBalls;
	unsigned int m_totalBalls;
	int m_remainingBalls;

	float m_remBallsDist;

	Catapult* mp_catapult;
	Ball* mp_ball;
	Camera* mp_cam;
	PowerSlider* mp_powerSlider;

	std::vector<int> m_musicIDTracks;

	Image m_HUDbkgroundTop;
	Image m_HUDbkgroundBottom;
	Image m_scoreImg;
	
	Button m_rotLeftButt;
	Button m_rotRightButt;
	Button m_fireButt;

	Text m_scoreTxt;
	Text m_targetTxt;
	Text m_remBallsTxt;

	CustomCursor m_custCursor;
};

typedef Singleton<PlayState> ThePlayState;

#endif